package com.thor.palmmall.rest.order.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.order.AOrderActivitie;
import com.thor.palmmall.spi.order.SOrderActivitie;

public class SOrderActivitieConverter  implements Converter<List<AOrderActivitie>,List<SOrderActivitie>>  {
	public static SOrderActivitieConverter getInstance() {
		if (instance == null)
			instance = new SOrderActivitieConverter();
		return instance;
	}

	private static SOrderActivitieConverter instance;
	
	@Override
	public List<SOrderActivitie> convert(List<AOrderActivitie> sourceList) {
		if(sourceList == null || sourceList.size()==0){
			return null;
		}
		List<SOrderActivitie> list = new ArrayList<SOrderActivitie>();
		for (AOrderActivitie source : sourceList) {
			SOrderActivitie target = new SOrderActivitie();
			target.setUuid(source.getUuid());
			target.setActivityName(source.getActivityName());
			target.setPromotionUuid(source.getPromotionUuid());
		
			list.add(target);
		}
		
		return list;
	}

}
